package com.jiangtai.smartbox.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jiangtai.smartbox.R
import com.jiangtai.smartbox.bean.BoxBean

/**
 * Created by heCunCun on 2021/5/20
 */
class BoxAdapter : BaseQuickAdapter<BoxBean, BaseViewHolder>(R.layout.item_box) {
    override fun convert(helper: BaseViewHolder, item: BoxBean?) {
        item ?: return
        val tvNum = helper.getView<TextView>(R.id.tv_num)
        tvNum.text = item.boxId
        if (item.empty) {
            tvNum.setBackgroundColor(mContext.resources.getColor(R.color.color_red))
        } else {
            tvNum.setBackgroundColor(mContext.resources.getColor(R.color.color_blue))
        }
        if (item.isChecked){
            tvNum.setBackgroundColor(mContext.resources.getColor(R.color.teal_200))
        }
    }

}